define(function (require, exports, module) {
        var jsonAPI = require('json-api');
        var whiteList = ['#login', '#register','#agreement'];              //不需要检查用户是否注册的链接

        module.exports.isLogin = exports.available = function () {
                return localStorage.uway_user != null;
        };

        module.exports.getLoginUser = function () {
                return localStorage.uway_user;
        };
        module.exports.hasPrivilege = function (hash) {
               // alert(hash);
           //     alert((localStorage.uway_user != null&&localStorage.uway_user.mobile!=null) || whiteList.indexOf(hash) != -1);
                return localStorage.uway_user != null || whiteList.indexOf(hash) != -1;
        };

        module.exports.saveUserMoblie = function (mobile) {
                 localStorage.uway_user =mobile
        };

        module.exports.saveUserOpenId = function (openid) {
                return localStorage.uway_openid = openid
        };

        module.exports.hasOpenId = function () {
                return localStorage.uway_openid !=null
        };

        module.exports.getOpenId = function () {
                return localStorage.uway_openid;
        };

});
